package com.yidu.qianfeng.common.util;


/**
 * @Author: TangSheng
 * @Description: json格式消息工具
 * @Date Created in 19:03 2021/3/17
 * @since 1.0
 */
public class JsonMsgUtil {


    /**
     *  创建json格式的消息
     * @param reason 用来判断的依据，大于0为success,小于0为fail
     * @param successMsg 成功时消息
     * @param failMsg 失败时的消息
     * @return 判断后的消息
     */
    public static String createJsonMessage(int reason, String successMsg, String failMsg){
        String msg = "";
        if (reason > 0){
            msg = "{\"result\":\"success\",\"msg\":\""+successMsg+"\"}";
        }else {
            msg = "{\"result\":\"fail\",\"msg\":\""+failMsg+"\"}";
        }
        return msg;
    }


}
